package com.gpagers.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.ModelAndView;

import com.gpagers.dao.UserMapper;


public class BaseController {
	
	@Autowired
	UserMapper userMapper;

	protected ModelAndView createSingleView(String path) {
		ModelAndView view = new ModelAndView();
		view.setViewName(path);
		return view;
	}

	protected ModelAndView createLayoutView(String path) {
		return createLayoutView(path, null);
	}

	//本页面是上中下结构
	protected ModelAndView createLayoutView(String path, String layout) {
		ModelAndView view = new ModelAndView();
		if (layout == null)
			view.setViewName("custom/layout");
		else
			view.setViewName(layout);
		view.addObject("header_path", "custom/header.vm");
		view.addObject("footer_path", "custom/footer.vm");
		view.addObject("content_path", path);
		return view;
	}

}
